<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@page import="com.xcalendar.constant.XConstants"%>
<% 
String locationString = "";
locationString = (String) request.getSession().getAttribute(XConstants.JSONLOCATIONS);
System.out.print("edit:"+locationString);
%>
<%@page import="java.util.List"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Map"%>
<%@page import="org.json.JSONException"%>
<%@page import="org.json.JSONObject"%>
<%@page import="org.json.JSONArray"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel='stylesheet' type='text/css' href='../css/ui-lightness/jquery-ui-1.8.16.custom.css' />
<script type='text/javascript' src='../jquery/jquery-1.6.2.min.js'></script>
<script type='text/javascript' src='../jquery/jquery-ui-1.8.16.custom.min.js'></script>
<script type='text/javascript' src='../jquery/jquery-ui-timepicker-addon.js'></script>
<title>Edit Event Page</title>
<script>
	$(function() {
		$( "input:submit, a, button").button();
		$('#start,#end').datetimepicker({
			timeFormat: 'hh:mm',
			stepHour: 1,
			stepMinute: 30
		});
	});
</script>
<style type='text/css'>
body {
	margin-top: 40px;
	text-align: center;
	font-size: 14px;
	font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
	color: #007fff;
	background-image:url(../bg/6_3.jpg); 
	background-position: center;
	background-attachment: fixed;
	repeat-x: #FFFFFF
}

.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
</style>
</head>
<body>
<div align="center">Edit Event</div>
<div align="center">
		<form action="/editEventController" method="post">
			<table>
				<tr>
					<td>Title :</td>
					<td><input type="text" name="title" class="text ui-widget-content ui-corner-all" value=<%=request.getParameter("title")%> />
					</td>
				</tr>
				<tr>
					<td>Description :</td>
					<td><input type="text" name="description" class="text ui-widget-content ui-corner-all" value=<%=request.getParameter("description")%> />
					</td>
				</tr>
				<tr>
					<td>Start :</td>
					<td><input type="text" id="start" name="start" class="text ui-widget-content ui-corner-all" value=<%=request.getParameter("start")%> />
					</td>
				</tr>
				<tr>
					<td>End :</td>
					<td><input type="text" id="end" name="end" class="text ui-widget-content ui-corner-all" value=<%=request.getParameter("end")%> />
					</td>
				</tr>
				<tr>
		<td>Location : </td>
		<td id="location" >
			
			<select id="locationKey" name="locationKey" class="text ui-widget-content ui-corner-all">
			<option selected="selected">Select your locations</option>
					<%
					
					Map<String, String> valueMap = new HashMap<String, String>();
				if(locationString != null){
				JSONArray jsonArray = new JSONArray(locationString);
				
				
				for(int j=0;j<jsonArray.length();j++){
					JSONObject jsonObject = jsonArray.getJSONObject(j);
					String key = jsonObject.getString("locationName");
					String value = jsonObject.getString("key");
	  
				    valueMap.put(key, value);
				  
			%>

			<option value="<%=value%>"><%=key%></option>

			<%
				}}
			%>
		

			</select>
			
		</td>
	</tr>
			</table>
			<input type="hidden" name="id" value=<%=request.getParameter("id")%> />
			<input type="hidden" name="view" value=<%=request.getParameter("view")%> />
			<br /> <a href="homepage_calendar.jsp?view=<%=request.getParameter("view")%>" > Return </a><input type="submit" value="Save" />
		</form>
	</div>
</body>
</html>